package 剑指offer;

import leetcode.day_2020_12_14_12_21.TreeNode;

public class Offer_JZ18 {
    public TreeNode Mirror (TreeNode pRoot) {
        if (pRoot == null) {
            return null;
        }
        TreeNode temp = pRoot.left;
        pRoot.left = pRoot.right;
        pRoot.right = temp;
        if (pRoot.left != null) {
            Mirror(pRoot.left);
        }
        if (pRoot.right != null) {
            Mirror(pRoot.right);
        }
        return pRoot;
    }
}
